Isometric algorithm [fixed]

Posted by David on Game Development See other posts from Game Development or by David
Published on 2012-06-25T03:26:24Z Indexed on 2012/06/25 9:24 UTC
Read the original article Hit count: 280

Filed under:
|
|
|

so i've been toying with isometric and i just cant get the tiles to be in the right order. im probably missing something obvious and i just cant see it... but even at the risk of looking stupid, heres my code.

for (int i = 0; i < Tile.MapSize; i++)
        {
for (int j = 0; j < Tile.MapSize; j++)
            {
                spriteBatch.Draw(
                    Tile.TileSetTexture, new Rectangle(
                        (-j * Tile.TileWidth / 2) + (i * Tile.TileWidth / 2),
                        (i * (Tile.TileHeight - 9) / 2) - (-j * (Tile.TileHeight - 9) / 2),
                        Tile.TileWidth, Tile.TileHeight),
                    Tile.GetSourceRectangle(tileID),
                    Color.White,
                    0.0f,
                    new Vector2(-350, -60),
                    SpriteEffects.None,
                    1.0f);
            }

}

and heres what i end up with

delicious messed up map

yep, bit of an issue. so if anyone could help, i'd appreciate it.

edit*

works now <_<

© Game Development or respective owner

Related posts about XNA

Related posts about c#